<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of searchDASRegistry</title>
  <meta name="keywords" content="searchDASRegistry">
  <meta name="description" content="SEARCHDASREGISTRY executes the specified query to interact with DAS Registry">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">code</a> &gt; searchDASRegistry.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for code&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>searchDASRegistry
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>SEARCHDASREGISTRY executes the specified query to interact with DAS Registry</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [xmlStruct, xml,status] = searchDASRegistry(varargin) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> SEARCHDASREGISTRY executes the specified query to interact with DAS Registry

 SEARCHDASREGISTRY queries the DAS Registry for finding DAS services.
 There are several possible ways to look for DAS services, including by
 label, organism, authority, capability, coordinate system type and URI.
 For a full documentation refer to http://www.dasregistry.org

 SYNTAX: [xmlStruct, xml,status] = searchDASRegistry(varargin)
          xmlStruct - struct resulted from parsing DAS XML
          xml - DAS XML
          status - status returned by readDASURL

 EXAMPLES
 
     Search DAS Services by label
     [xmlStruct, xml,status] = searchDASRegistry('label','biosapiens');
     
     Search DAS Services by organism
     [xmlStruct, xml,status] = searchDASRegistry('organism','Homo sapiens');
     
     Search DAS Services by authority
     [xmlStruct, xml,status] = searchDASRegistry('authority','Uniprot');
     
     Search DAS Services that accepts structure command (protein 3D data)
     [xmlStruct, xml,status] = searchDASRegistry('capability','structure');
     
     Search the specific DAS Service specified by the URI
     [xmlStruct, xml,status] = searchDASRegistry('URI','DS_409');
 
 See also <a href="executeDASCommand.html" class="code" title="function [xmlStruct, xml,status,dasUrl] = executeDASCommand(serverURL,varargin)">EXECUTEDASCOMMAND</a>

    DASMiner: DAS library and browser for Matlab.
    Diogo Veiga, March 2008.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>	READDASURL attempts to read the DAS URL within the specified timeout</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="addNewServer.html" class="code" title="function [status] = addNewServer(uri,msgBox)">addNewServer</a>	ADDNEWSERVER adds a new DAS service for browsing within the browser</li><li><a href="searchRegistry_gui.html" class="code" title="function varargout = searchRegistry_gui(varargin)">searchRegistry_gui</a>	SEARCHREGISTRY_GUI is the GUI for DAS Registry search in Browser</li></ul>
<!-- crossreference -->

<h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="#_sub1" class="code">function [res] = isValidCommand(x)</a></li><li><a href="#_sub2" class="code">function [res] = isValidURI(x)</a></li></ul>
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [xmlStruct, xml,status] = searchDASRegistry(varargin)</a>
0002 <span class="comment">% SEARCHDASREGISTRY executes the specified query to interact with DAS Registry</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% SEARCHDASREGISTRY queries the DAS Registry for finding DAS services.</span>
0005 <span class="comment">% There are several possible ways to look for DAS services, including by</span>
0006 <span class="comment">% label, organism, authority, capability, coordinate system type and URI.</span>
0007 <span class="comment">% For a full documentation refer to http://www.dasregistry.org</span>
0008 <span class="comment">%</span>
0009 <span class="comment">% SYNTAX: [xmlStruct, xml,status] = searchDASRegistry(varargin)</span>
0010 <span class="comment">%          xmlStruct - struct resulted from parsing DAS XML</span>
0011 <span class="comment">%          xml - DAS XML</span>
0012 <span class="comment">%          status - status returned by readDASURL</span>
0013 <span class="comment">%</span>
0014 <span class="comment">% EXAMPLES</span>
0015 <span class="comment">%</span>
0016 <span class="comment">%     Search DAS Services by label</span>
0017 <span class="comment">%     [xmlStruct, xml,status] = searchDASRegistry('label','biosapiens');</span>
0018 <span class="comment">%</span>
0019 <span class="comment">%     Search DAS Services by organism</span>
0020 <span class="comment">%     [xmlStruct, xml,status] = searchDASRegistry('organism','Homo sapiens');</span>
0021 <span class="comment">%</span>
0022 <span class="comment">%     Search DAS Services by authority</span>
0023 <span class="comment">%     [xmlStruct, xml,status] = searchDASRegistry('authority','Uniprot');</span>
0024 <span class="comment">%</span>
0025 <span class="comment">%     Search DAS Services that accepts structure command (protein 3D data)</span>
0026 <span class="comment">%     [xmlStruct, xml,status] = searchDASRegistry('capability','structure');</span>
0027 <span class="comment">%</span>
0028 <span class="comment">%     Search the specific DAS Service specified by the URI</span>
0029 <span class="comment">%     [xmlStruct, xml,status] = searchDASRegistry('URI','DS_409');</span>
0030 <span class="comment">%</span>
0031 <span class="comment">% See also EXECUTEDASCOMMAND</span>
0032 <span class="comment">%</span>
0033 <span class="comment">%    DASMiner: DAS library and browser for Matlab.</span>
0034 <span class="comment">%    Diogo Veiga, March 2008.</span>
0035 
0036 
0037 p = inputParser;   <span class="comment">% Create an instance of the class.</span>
0038 
0039 p.addParamValue(<span class="string">'label'</span>, <span class="string">''</span>, @ischar);
0040 p.addParamValue(<span class="string">'organism'</span>, <span class="string">''</span>, @ischar); 
0041 p.addParamValue(<span class="string">'authority'</span>, <span class="string">''</span>, @ischar);
0042 p.addParamValue(<span class="string">'capability'</span>, <span class="string">''</span>, @(x) <a href="#_sub1" class="code" title="subfunction [res] = isValidCommand(x)">isValidCommand</a>(x)); <span class="comment">%check if it is a valid ID?</span>
0043 p.addParamValue(<span class="string">'type'</span>, <span class="string">''</span>, @ischar);
0044 p.addParamValue(<span class="string">'URI'</span>, <span class="string">''</span>, @ischar);
0045 p.addParamValue(<span class="string">'timeout'</span>, 30000, @isnumeric); <span class="comment">%time in miliseconds</span>
0046 
0047 p.KeepUnmatched = true;
0048 p.FunctionName = <span class="string">'SEARCHDASREGISTRY'</span>;
0049 p.parse(varargin{:});
0050 
0051 
0052 
0053 <span class="keyword">if</span> (isempty(p.Results.label) &amp;&amp; isempty(p.Results.organism) &amp;&amp; isempty(p.Results.authority) &amp;&amp; isempty(p.Results.capability) <span class="keyword">...</span>
0054         &amp;&amp; isempty(p.Results.type) &amp;&amp; isempty(p.Results.URI)) <span class="comment">% Get all sources</span>
0055     [xmlStruct, xml, status] = <a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>(<span class="string">'http://www.dasregistry.org/das1/sources/'</span>,p.Results.timeout);
0056     <span class="keyword">return</span>;
0057 <span class="keyword">end</span>
0058 
0059 
0060 <span class="keyword">if</span> ( ( (~isempty(p.Results.label)) + (~isempty(p.Results.organism)) + (~isempty(p.Results.authority)) + (~isempty(p.Results.capability)) <span class="keyword">...</span>
0061         + (~isempty(p.Results.type)) + (~isempty(p.Results.URI)) ) &gt; 1)
0062     error(<span class="string">'The search is limited to 1 criterium at time'</span>);
0063 <span class="keyword">end</span>
0064 
0065 <span class="keyword">if</span> (~isempty(p.Results.label))
0066     dasURL = strcat(<span class="string">'http://www.dasregistry.org/das1/sources?label='</span>, char(java.net.URLEncoder.encode(p.Results.label,<span class="string">'UTF-8'</span>)));
0067     [xmlStruct, xml, status] = <a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>(dasURL,p.Results.timeout);
0068     <span class="keyword">return</span>;
0069 <span class="keyword">end</span>
0070 
0071 <span class="keyword">if</span> (~isempty(p.Results.organism))
0072     dasURL = strcat(<span class="string">'http://www.dasregistry.org/das1/sources?organism='</span>,char(java.net.URLEncoder.encode(p.Results.organism,<span class="string">'UTF-8'</span>)));
0073     [xmlStruct, xml, status] = <a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>(dasURL,p.Results.timeout);
0074     <span class="keyword">return</span>;
0075 <span class="keyword">end</span>
0076 
0077 <span class="keyword">if</span> (~isempty(p.Results.authority))
0078     dasURL = strcat(<span class="string">'http://www.dasregistry.org/das1/sources?authority='</span>,char(java.net.URLEncoder.encode(p.Results.authority,<span class="string">'UTF-8'</span>)));
0079     [xmlStruct, xml, status] = <a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>(dasURL,p.Results.timeout);
0080     <span class="keyword">return</span>;
0081 <span class="keyword">end</span>
0082 
0083 <span class="keyword">if</span> (~isempty(p.Results.capability))
0084     dasURL = strcat(<span class="string">'http://www.dasregistry.org/das1/sources?capability='</span>,char(java.net.URLEncoder.encode(p.Results.capability,<span class="string">'UTF-8'</span>)));
0085     [xmlStruct, xml, status] = <a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>(dasURL,p.Results.timeout);
0086     <span class="keyword">return</span>;
0087 <span class="keyword">end</span>
0088 
0089 <span class="keyword">if</span> (~isempty(p.Results.type))
0090     dasURL = strcat(<span class="string">'http://www.dasregistry.org/das1/sources?type='</span>,char(java.net.URLEncoder.encode(p.Results.type,<span class="string">'UTF-8'</span>)));
0091     [xmlStruct, xml, status] = <a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>(dasURL,p.Results.timeout);
0092     <span class="keyword">return</span>;
0093 <span class="keyword">end</span>
0094 
0095 <span class="keyword">if</span> (~isempty(p.Results.URI))
0096     dasURL = strcat(<span class="string">'http://www.dasregistry.org/das1/sources/'</span>,char(java.net.URLEncoder.encode(p.Results.URI,<span class="string">'UTF-8'</span>)));
0097     [xmlStruct, xml, status] = <a href="readDASURL.html" class="code" title="function [xmlStruct, xml, status] = readDASURL(dasUrl,timeout)">readDASURL</a>(dasURL,p.Results.timeout);
0098     <span class="keyword">return</span>;
0099 <span class="keyword">end</span>
0100 
0101 
0102 <a name="_sub1" href="#_subfunctions" class="code">function [res] = isValidCommand(x)</a>
0103 
0104 res = any(strcmpi(x,{<span class="string">'dsn'</span>,<span class="string">'entry_points'</span>, <span class="string">'dna'</span>, <span class="string">'sequence'</span>, <span class="string">'types'</span>, <span class="string">'features'</span>, <span class="string">'stylesheet'</span>, <span class="string">'structure'</span>, <span class="string">'alignment'</span>,<span class="string">'interaction'</span>}));
0105 
0106 <a name="_sub2" href="#_subfunctions" class="code">function [res] = isValidURI(x)</a>
0107 
0108 match = regexp(x,<span class="string">'DS_\d*'</span>,<span class="string">'match'</span>);
0109 res = isempty(match);</pre></div>
<hr><address>Generated on Tue 17-Feb-2009 16:59:45 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>